<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>     
    </div>
</body>
<script>

function isUndefined(arg){
    // if(typeof arg =='object'){
    //     // return Object.keys(arg).length === 0
    // }
    if(arg!==null && typeof arg=="object")
        return Object.keys(arg).length === 0
    return arg===undefined 
}

/*
实现一个判断传入的参数是否为null类型
返回一个布尔值，如果是null 为true，否之，为fase
*/
function isNull(arg){

    //do something

    return arg===null
}

// 测试用例
var expUndefined = undefined;
var expNull = null; 
var expZero = 0;
var a;
var o = new Object();
console.log(isUndefined(expUndefined)); // ->true
console.log(isUndefined(expNull)); // ->false
console.log(isUndefined(a)); // ->true
console.log(isUndefined(o)); // ->true  d
console.log(isNull(expUndefined)); // ->false  
console.log(isNull(expNull)); // ->true
console.log(isNull(expZero)); // ->false
console.log(isNull(a)); // ->false
console.log(isNull(o)); // ->false
</script>
</html>